How I can grant write permission to the file Preferences.sublime-settings and locate this file of Sublime Text 3 using Elementary OS Luna? - linux

I cannot grant write permission to the file Preferences.sublime-settings in Sublime Text on Elementary OS Luna 3. If someone went through it, can you help me?
There is no way to go to the directory where it is because it simply is not in the way I get by clicking with the right button of mouse > Copy File Path.
I get this path:
/home/llarruda/.config/sublime-text-3/Packages/Default/Preferences.sublime-settings
In the directory Packages i just have the directories User and the link of current directory (.) and level return link (..).
I sailed across the directory tree for the Sublime Text 3, via bash, listing including hidden directories, nothing positive. I tried to grant permissions recursively to the for the whole Sublime Text 3 directory and even the innermost level that I can access and should contain the file Preferences.sublime-settings, I haven't success.
I did the install from the .deb package obtained on the official website.
PS: I want grant write permission, but I force give to the whole directory full permition - sudo chmod -R 777 sublime-text-3, that inside on .config directory

In ST3, plugins/packages are run directly from the .sublime-package file. For most things, you don't actually need the contents of those files. For instance, you can create a Preferences.sublime-settings in the user folder, and it will be merged properly. That being said, ST3 does allow you to override files. To make things easier, you can use the plugin PackageResourceViewer. I wrote it to assist with viewing default files. Again, you don't need to do this for your particular case though. In the menu, go to Preferences -> Settings - User. This will create a preferences file in the user directory. When merged, the values in the User directory will be used rather than those in Default.

Related

Default folder missing in Sublime Text 3 directory

After installing Sublime Text 3, I try to use a custom keyboard shortcut (F5) defined in:
~/.config/sublime-text-3/Packages/User/Default (Linux).sublime-keymap
The shortcut doesn't work, and I see in the console the following message:
Unable to open /home/gabriel/.config/sublime-text-3/Packages/Default/Preferences.sublime-settings
Not only this file is missing in ST's install directory, the entire ~/.config/sublime-text-3/Packages/Default/ folder is missing. But If I open Preferences/Key Bindings, the default keymap file is opened correctly:
and the path shown for that file is within the ~/.config/sublime-text-3/Packages/Default/ folder, which I know is not there (!)
What is going on here? How can I fix this?
Why the Key Binding is not working is nothing to do with the default file paths, the directory not existing, or the console errors.
Restart Sublime Text and the Key Binding will work. Enable command logging to see that it's working: in the console sublime.log_commands(True).
Sublime text shouldn't be displaying the paths for those Default package files. The ~/.config/sublime-text-3/Packages/Default/ directory doesn't exist because those files are distributed with Sublime Text, you'll find the files in the the Default package where Sublime Text is installed e.g. /path/to/sublime_text_3/Packages/Default.sublime-package. .sublime-package files are essentially zip files. Ignore those paths, and the error messages in the console. Those are Sublime Text issues.
None of these answers are directly solving the problem you nerds.
For the silicon-challenged, what you need to do is this:
go to the path that it's telling you doesn't exist:
/home/gabriel/.config/sublime-text-3/Packages/Default/Preferences.sublime-settings
You are on the right track to deducing the source of the problem - I have the same problem but It wouldn't allow me to change the font for my text editing. Sublime must have an install problem. I'm on ubuntu 16.04 LTS .
Do this:
a. create the folder, name it "Default" - under "Packages"
b. go to your sublime text and go to preferences -> settings
c. copy everything on the LEFT side (it should be showing a full list of defaults, which you can't edit, and a user changeable file on the right)
d. go to the folder you just made (Default) -> inside it create a file with the exact name "Preferences.sublime-settings"
e. paste everything into it
f. restart sublime text
g. You are now a G
you're welcome
I arrived here via a very similar search for why a directory was not being displayed in sublime text. In case anyone else arrives here from the same search, here's why:
directories that are known to house source control information and various binary output files are automatically excluded from the sidebar
Source: https://forum.sublimetext.com/t/missing-files-in-folder-tree/31145/3

Where do some sublime packages and default settings go?

Sometimes I install a new sublime package and a new directory gets added to the /Users/max/Library/Application Support/Sublime Text 3/Packages directory, which I like because I can use a bookmark with FuzzyFileNav and quickly browse the default .sublime-settings and .sublime-key files to get my bearings about what is going on with this package. However sometimes there is no entry added, as shown below (ironically with FuzzyFileNav)
So then the way I would find the .sublime-settings and .sublime-keymap files is to use the dropdown menu in sublime also shown below:
What I'm wondering is:
Why do some packages add entries to my Packages directory and other don't?
If there is no entry in Packages then where do the package specific .sublime-settings and .sublime-keymap files live?
My main goal is to be able to quickly navigate between my User and Default settings but it makes it hard when I'm feeling like Hansel and wondering where'd all the files go...you know :)
One workaround that might work is to copy all the Default .sublime-settings and .sublime-keymap files that don't live in the Packages directory and put them in the User directory and rename them to PackageName.sublime-settings and PackageName.sublime-keymap and then I'll be able to browse them anyways because I also have a bookmark to User. I think that would work because it would overwrite all the Default settings (that live somewhere) with all the exact same settings. Or maybe I could do that same thing except put the files in the Default directory; however, from what I've been reading it's bad form to modify the Default directory. Obviously the most ideal thing would be to just figure out where the heck these files are.
Sublime Text uses different folder locations for different kinds of packages. For instance, all packaged files install to Installed Packages and are self-contained in a standard Zip file using the file extension .sublime-package. When a package includes a file .no-sublime-package, the package will be extracted. All extracted packages are stored in the Packages folder.
Settings and keymaps are stored within both packed and unpacked packages. Those can be overruled/extended by saving them to Packages/User.
Detailed information on package locations and hierarchy can be found in the Package Control documentation.
idleberg's answer contains a good explanation of why you were unable to find .sublime-package files & unpackaged files in the same location.
The following information details an alternative method you can use to navigate all package files, whether packed or unpacked.
All of SublimeTexst's installed package files can be navigated and edited via PackageResourceViewer's PackageResourceViewer: Open Resource command.
Any files that are edited from a .sublime-package file will have a new instance created at Packages/PackageName. The new file will now override the original file ( which still exists in the .sublime-package file ). The original file can be reactivated by deleting the edited file.
Files edited from an unpacked package will be affected directly.
If both packaged & unpackaged instances of a file exist, PackageResourceViewer will open the unpackaged instance.

Installed .desktop file to have user's home directory path inserted

Wording the title was a little tricky, but here's the situation. I am making a install.sh file for my game which is written in Python. I am trying to create a game folder with all assets instead of making this a module for Python. I may be doing things the hard way, but this method seems to work well.
The install.sh copies the game's directory to the HOME folder and moves a .desktop file and game's icon to the appropriate places (ie. desktop, applications folder). The issue is, this .desktop file uses Icon=~/.local/share/icons/game.png and Exec=~/Game/game.sh which causes the icon not to show up in the .desktop file or menu nor does the game shortcut execute. I replaced the ~ with $HOME and I get the same issue. However, if I change it to /home/(my account) instead of ~ or $HOME it will work perfectly and show the icon.
Is there a way to make the install bash file create this .desktop file dynamically if a user installs the game? Or is there some way of getting this to work that I am unaware of?
EDIT: Better explanation... ish.
Alternatively, put ~/.local/share/applications in the premade .desktop file, and then sed 's/~/$HOME/g' appname.desktop > $HOME/.local/share/applications/appname.desktop in the installer script, or invoke that from your language interpreter as a shell exec.
It's a real shame that more projects with GUIs don't do this. These desktop files also need a 'wmClass' element in them in order to allow for the launcher to also be a window tab. I've manually fixed several applications for my convenience this way.
Seems the easiest way was to include the files system-wide. While not my intention, it made it far easier to install all the proper files and get things works.
Putting the .desktop file in /usr/share/applications and icon file in /usr/share/icons/

Where are the default packages in Sublime Text 3 on Ubuntu?

I'm migrating from Sublime Text 2 to 3. In Sublime Text 2, I changed a lot of the default settings of the editor -- such as the tab bar height, sidebar color, etc. -- by modifying the Default.sublime-theme file in sublime-text-2/Packages/Theme - Default. I was also able to modify the colors of the default color schemes in a similar fashion. I've been trying to figure out how to do this for Sublime Text 3, but can't seem to find these files. ~/.config/sublime-text-3 only seems to contain overrides for user settings, not the default settings.
This link on the Sublime Text forums seems to give the location for Windows and Mac, but not for Ubuntu. I've searched a bit to no avail. Does anyone have suggestions?
Thank you!
To amplify on #skuroda's answer - ST3 contains all of its data that, in ST2, was stored in Packages/PackageName, in PackageName.sublime-package files that are basically just zip files, or "Resources" as they're now known. Using PackageResourceViewer, you can easily edit the individual files contained within the resource, then save it back again. When saved, the proper directory structure under Packages/PackageName will be created, allowing you to edit the file directly next time. The way file precedence works in Sublime, any file that exists in ~/.config/sublime-text-3/Packages/PackageName/ will override any file of the same name stored in PackageName.sublime-package.
However, since you don't want these files to be accidentally overwritten, I would suggest creating ~/config/sublime-text-3/Packages/User/Themes/ and User/Color Schemes directories and storing your customized files there instead. The User/ directory is protected from overwrites during upgrades, etc., and unless you're planning on creating a customized theme or color scheme for redistribution through Package Control, it's best practice to keep your files in there.
EDIT
I just realized you hadn't gotten an answer to your original question - where are the files stored? If you installed the .deb file from sublimetext.com, all the .sublime-package files are in /opt/sublime_text/Packages.
If you want the easiest way to save your customized settings first copy all the default settings and paste into a new file named Preferences.sublime-settings.
Then make your changes and save the file to:
/home/**username**/.config/sublime-text-3/Packages/User
In order to see the .config folder you will have to enable show hidden files.
The instructions are written at the top of the default settings list in case you are wondering where got this from.
In the ST console, try entering sublime.executable_path(). This should get you close to where you need to be. Also, you should copy the content of the file out and move them (under a new name to the packages folder). You probably don't want your modifications to be reverted on subsequent update. An alternative method is to try overriding the files you need to. I haven't done that for theme files, so I'm unsure if everything will work as it should. If you take the override route, I'd recommend using PackageResourceViewer. I wrote it to help with browsing/overriding package files in ST3.
You can use
dpkg -L <package name>
For example
dpkg -L subli<tab>
Just open up sublime text, hit ctrl+` to open sublime text console, then run these command accordingly
sublime.packages_path() to see user installed packages directory
sublime.installed_packages_path() to see zipped packages (with .sublime-package file type) directory
Mostly likely, you'll find the Default package inside zipped packages directory.
You can use PackageResourceViewer to see zipped packages's contents as #MattDMo suggested, but more over, you can actually extract zipped packages into user installed package directory directly using PackageResourceViewer's extract command.

Setting up an icon for start menu folder group in InnoSetup

To my surprise I did not find the solution how to set up an icon for the start menu application group folder laying ahead. I am looking for the automatic solution in InnoSetup script.
Thank you in advance.
Create the desktop.ini file with the content like this if you want to use the *.ico as a resource (where c:\somepath\icon.ico is path to your icon):
[.ShellClassInfo]
IconResource=c:\somepath\icon.ico,0
Or create the desktop.ini file with the content like this if you want to use the icon from the executable as a resource (where c:\somepath\program.exe is path to your executable):
[.ShellClassInfo]
IconResource=c:\somepath\program.exe,0
Save this desktop.ini file into the directory where you want to apply the icon. One very important note, you have to set to this newly created file attributes Hidden and System, otherwise it won't work!
So please check very carefully if the InnoSetup won't clear these attributes if you'll have the file included in your setup package while installing.

Resources