I develop in pyqt and i made deb package on Ubuntu. It contain .desktop file, so it automatically add icon to main menu. When I start application windows title is correct but in gnome bar shows s_main.pyw which is name of main script in application. It is possible to set correct name in that bar?
Here's a link to image!
I found answer. Simply you can enter name of application in constructor of QApplication object. Like this.
app = QtGui.QApplication(['Here application name'])
This name shows in gnome shell.
Gnome required .desktop file located in /usr/share/applications or ~/.local/share/applications.
Example of myapp.desktop file:
[Desktop Entry]
Name=Application Name
Comment= My application description
Terminal=false
Type=Application
Categories=Development;Education
Exec=path/to/main-script
Icon=path/to/icon
Name from example will be displayed in Gnome top bar. Exec is path to your main script (in your case s_main.pyw).
Also you should restart Gnome to show changes (Alt + F2, type r and Enter).
Related
The following .desktop file shows up under "Other" but not "Science" as indicated by the category. How do I define the menu item under which it should show?
I'm using Mate Desktop 1.16.2, but I think this is a standard XDG thing so the window manager shouldn't matter too much.
]$ cat /usr/share/applications/xnec2c.desktop
[Desktop Entry]
Name=Xnec2c
GenericName=NEC2 Simulator
Comment=Numerical Electromagnetics Code software
Exec=xnec2c
Icon=xnec2c
Terminal=false
Type=Application
Categories=Science;
Keywords=nec2;em;simulator;
X-Desktop-File-Install-Version=0.23
MimeType=application/x-nec2;
See also this related question: Make xdg-utils associate a file extension with my application from a distribution package?
Is there a way to make NeoVim as default text/code editor (without any bad side effects) ?Trust me, I looked to lots of StackOverflow question/answers and tried a few things but nothing worked for me.
Note: I'm on macOS Big Sur (version 11.2.1). What I want is when I click on files to open in NeoVim.
--> For example, in ~/.zshrc (and added to ~/.bash_profile also just in case) I have:
Note: zsh is my default shell
alias nvim=$HOME/nvim-osx64/bin/nvim
export EDITOR="nvim"
export VISUAL="nvim"
When I do set in Terminal it shows:
EDITOR=nvim
VISUAL=nvim
And yes, I quit and started the terminal (I'm using iTerm2). I even reboot.
--> I will place my $PATH here just in case it has anything to do it that. When I do echo $PATH it shows:
--> And, just in case someone suggests:
I can't Select a File > Open With... and select NeoVim as default text editor, since that option doesn't show and I can't do Choose Other since I can't select NeoVim in that way.
If anyone needs more information, please say and I will edit the question with that info. Thanks!
Setting variables in the terminal will not affect the GUI file associations. To do that you have to change the OS's file associations.
Though it appears to be a small project and unsupported, I've had a good experience using duti. It's a wrapper around the Apple file extension API. The configuration did take me a minute to figure out. I'll post it if I can find it.
After a while I found the answer to my own question, here it is how you can set NeoVim in Mac as the default text editor. Now, you will be able click on files and opening them in NeoVim:
Some people recommended me to have a look at the follow links:
https://gist.github.com/Huluk/5117702
https://superuser.com/questions/139352/mac-os-x-how-to-open-vim-in-terminal-when-double-click-on-a-file
That didn't work for me but it served as a reference to look up related topics (automator + neovim).
After a while, I discover this blog:
https://blog.schembri.me/post/neovim-everywhere-on-macos/
Go and have a look at the blog, but here it is how you do it:
Launch Automator (Finder -> Applications -> Automator)
New Document -> Choose a type for your document: Application
In Actions search for Run AppleScript and drag that to where it says something like "Drag actions here..."
Delete the default example of AppleScript
Copy and Paste the code in the blog (where it says NeoVim.app) to where it previous had the default code
Save the new Automator app (save as aplicattion format). Save it in the Applications folder
Right-Click a file type you wish to open every time you click on them (e.g. .php file). Select Get Info or do cmd + i, it will open informations about that file. Scroll to wher it says Open With and select Other. Then just go to Aplicattions folder and select your new NeoVim "app".
Do the same to other file types if you wish.
You can now double click on your PHP files (or others if you did the same) and open them in NeoVim. Enjoy!
Note: You really need to do Right-Click, Get Info and look for Open With to change in all files with that extension. If you skip Get Info and just Right-Click + Open With, it will only work for that specific file...
This is the code from the blog:
on run {input, parameters}
set cmd to "nvim"
if input is not {} then
set filePath to POSIX path of input
set cmd to "nvim \"" & filePath & "\""
end if
tell application "iTerm"
create window with default profile
tell the current window
tell the current session to write text cmd
end tell
end tell
end run
This would open a new window even if you already had one open.
I change it so that it would open in a tab:
on run {input, parameters}
set cmd to "nvim"
if input is not {} then
set filePath to POSIX path of input
set cmd to "nvim \"" & filePath & "\""
end if
tell application "iTerm"
tell the current window
create tab with default profile
tell the current session to write text cmd
end tell
end tell
end run
Note: I'm using iTerm2. If you are using another Terminal Emulator, change where it says iTerm to the name of your terminal...
For anyone using Kitty on MacOS, I found a pretty simple way to accomplish this using the remote control feature.
First you need the following set in your kitty.conf:
allow_remote_control yes
listen_on unix:/tmp/mykitty
Using Automator like in #DGF's answer, I created an Application with the "Run Shell Script" action, and this is the script:
if [ -z "$(pgrep kitty)" ]
then
open /Applications/kitty.app
sleep 3 # allow ample time to startup and start listening
fi
/usr/local/bin/kitty # --to=unix:/tmp/mykitty-$(pgrep kitty) launch --type=os-window nvim "$#"
Save that as an application somewhere, and select it from "Open with"!
Note: to be honest, the logic to handle starting up kitty if it's not already running is a little flaky. But it seems to work great when kitty is already running, which of course it is most of the time for me. Also, it doesn't work at all if kitty is running but has no windows. :\
Choose nvim as the default application by means of a txt file sub-menu like here with Preview for PDFs:
I installed the Julia language for macOS as downloaded from the official website.
When I launch Julia, the REPL is launched in macOS's Terminal.app, but I wish to have it launched from iTerm. How can I tell julia to launch iTerm instead of Terminal.app?
The julia app uses apple script to tell the terminal to launch its process. You can modify the script and tell iTerm to be opened instead. For this:
Go to Go to Applications> press option-click (or right click if you have it) on the julia app you wish to modify and then click show package contents > contents > Resources > Scripts, and modify main.scpt.
My script reads
tell application "iTerm"
tell current window
create tab with default profile command "/Applications/Julia-1.5.app/Contents/Resources/julia/bin/julia"
activate
end tell
end tell
This makes the julia app to launch iTerm with the default profile instead of Terminal.app. It is possible that you need yo modify this path if the app is not called Julia-1.5, as in my case.
A second option is to create a symbolic link in your path to the Julia executable. For the example above, enter the following command in the terminal application of your choice:
ln -s /Applications/Julia-1.5.app/Contents/Resources/julia/bin/julia /usr/local/bin/julia
You will have to update this link to the path for the correct version whenever you upgrade Julia.
Now all you have to do to run the Julia REPL in iTerm (or any terminal application) is enter the command julia. (This assumes that /usr/local/bin is in your path.)
Add an alias in ~/.bash_profile or ~/.zshrc:
alias julia='/Applications/Julia-1.7.app/Contents/Resources/julia/bin/julia'
Change the version accordingly.
Note: Although this seems not the exact answer of the question, it leads to the same result of "making Julia launch in iTerm".
I am trying for days now, to set a custom Title to my terminal, I'm using bash as shell and I succeeded set a title only when a command is running with COMMAND_PROMPT.
I would like to know if there is a possibility to make this title permanent and appear when I open my terminal window.
You should be able to set that permanently from Terminal > Preferences > Profiles > Window.
Set your custom title on the Title textbox (ex. "TEST123").
You can also check/uncheck the other checkboxes here to show/hide the other elements of your title bar. For example, the "Active process name" will display bash (if bash is your login shell).
Try to uncheck them all then save that profile (Shell > Use Settings as Default) and restart your Terminal. When you open a new Terminal window, it should just show the title (and the current directory, which will get to in a moment) like this:
If you also want to get rid of the current directory, you'll have to add this to your .profile in your home directory (as mentioned on this answer):
unset PROMPT_COMMAND
When you again restart the Terminal, it should only have your custom title:
You can set the title like this :
echo -n "\033]0;${USER}#${HOST}\007"
More info here:
If you want this when you open the terminal, you can add your title to the .bachrc file
From the Terminal manual, if you look for "keyboard shortcuts" it states that you can edit a terminal title by doing:
Shift-Command-I
I want to launch my python programs into full screen or whenever i run it from cmd or powershell i always want to get the output into full screen. How can I do that ?
Create a shortcut for .cmd file and modify the Shortcut tab under Properties. Choose "Maximized" from Run: section.