Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Run command with Key Combination in Gnome

+0
−0

Is there a way in Ubuntu (22.04) to run a given bash command for a given Key combination in Gnome (42.9)? This Ubuntu is running in Hyper-V on a Win10 host.

(I would like to run the setxkbmap us and setxkbmap hu commands many times a day and finding the terminal and typing their aliases makes too much time. It would be even nicer if the same keyboard combination would do the two alternately, but I can do a Python script for that.)

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

0 comment threads

1 answer

+2
−0

Gnome should have a Settings app with a Keyboard shortcut section. Here you can click Add Custom Shortcut which will let you bind any key to any shell-style command. source

Unless you are very sure of your command, I would recommend wrapping it in a script that also emits logs somewhere. If the command fails there is usually little indication, so it can be hard to troubleshoot otherwise.

History
Why does this post require moderator attention?
You might want to add some details to your flag.

2 comment threads

+1 for the logs - that's a very good advice (1 comment)
Works for me (1 comment)

Sign up to answer this question »