├── README.md ├── hotkeys-samples ├── gnome-hotkeys ├── gnome-hotkeys-import └── kde_hotkeys.khotkeys ├── showwin └── showwinDetach /README.md: -------------------------------------------------------------------------------- 1 | # Showwin-Script 2 | Linux script for quick switching active window using hot keys. 3 | 4 | Bind some hot keys in your linux desktop environment to this script with window description (e.g. part of window name) and action for case when no suitable window is found. Switch to specified window using hot key. 5 | 6 | # Prerequisites 7 | Console tools *wmctrl* and *xdotool* are required. In Ubuntu they can be installed using apt: 8 | ``` 9 | sudo apt-get install wmctrl xdotool 10 | ``` 11 | 12 | Both scripts *showwin* and *showwinDetach* should be in your *$PATH* dir. Clone repository somewhere and add symlinks to scripts into *~/bin* directory. 13 | 14 | # Usage 15 | Generic usage of script *showwin* is the following: 16 | ``` 17 | showwin "$WINDOW_NAME" "$OPEN_WINDOW_COMMAND" 18 | ``` 19 | Script will search for a windows with *$WINDOW_NAME* in title and make it active. If no appropriate window is found script will run command *$OPEN_WINDOW_COMMAND*. 20 | 21 | ## Which *$WINDOW_NAME* to use 22 | List of opened windows can be got using command *wmctrl -l -x*: 23 | ``` 24 | $ wmctrl -l -x 25 | ... 26 | 0x04400010 0 Navigator.Firefox masyamandev-UX360CA Options - Mozilla Firefox 27 | 0x04400267 0 Navigator.Firefox masyamandev-UX360CA readme.md code - Google - Mozilla Firefox (Private Browsing) 28 | ``` 29 | Parameter *$WINDOW_NAME* is a *grep* regex. It's desirable to use expressions which can describe only one window. 30 | 31 | ## Use case 1: switch to a specific program 32 | Let's bind hot key *Alt+F* to command: 33 | ``` 34 | showwin " - Mozilla Firefox$" "firefox" 35 | ``` 36 | This will search for a window with title " - Mozilla Firefox[end_of_string]" and switch to it. If no appropriate window is found then script will launch Firefox. 37 | This example will switch to private window (or open new one) in Firefox: 38 | ``` 39 | showwin " - Mozilla Firefox (Private Browsing)$" "firefox -private-window" 40 | ``` 41 | If this script is binded to some other hot key (e.g. *Alt+P*) then it will be easily to switch to Firefox windows even if Firefox has not been opened yet. 42 | 43 | ## Use case 2: when more than one window is fit to regular expressions 44 | Let's continue previous example with binded hot keys *Alt+F* and *Alt+P*. Assuming user is pressing *Alt+F*. If multiple windows of Firefox is open, then script will not have possibility to define which window is needed to switch to: 45 | ``` 46 | $ wmctrl -l -x 47 | ... 48 | 0x04400010 0 Navigator.Firefox masyamandev-UX360CA Options - Mozilla Firefox 49 | 0x044002b9 0 Navigator.Firefox masyamandev-UX360CA Ubuntu Start Page - Mozilla Firefox 50 | ``` 51 | By default window with smaller window id will be used. This window id is stored and will be used to switch to the same window unless it's closed. 52 | It's possible to attach another matching window to the same hot key. To do it hot key command *showwinDetach* should be called before pressing the hot key. It will unassign window id from a hot key and assign active window. It's recommended to bind script *showwinDetach* to some hot key, e.g. *Alt+Backspace*. 53 | 54 | Here is an example of usage of setup above: 55 | 1. Assuming that no Firefox application is run at the moment. 56 | 2. Pressing hot key *Alt+F* will open new Firefox window. 57 | 3. While working with other applications pressing *Alt+F* will switch to Firefox. 58 | 4. If second window of Firefox is open, pressing *Alt+F* will activate first window of Firefox. 59 | 5. To assign another Firefox window to hot key *Alt+F* you have to activate 2nd window, press *Alt+Backspace* and then *Alt+F*. 60 | 6. Pressing hot key *Alt+F* will open 2nd Firefox window. 61 | 62 | ## Use case 3: customizable attaching 63 | It's possible to bind special hot keys which will be assignable to any window. To do this hot key should be bind to script *showwin* without second *$OPEN_WINDOW_COMMAND* argument. In this case parameter *$WINDOW_NAME* will work as hot key identifier. Here is an example of binding customizable hot keys: 64 | ``` 65 | Alt+1 -> showwin "CustomKey1" 66 | Alt+2 -> showwin "CustomKey2" 67 | ... 68 | Alt+0 -> showwin "CustomKey0" 69 | Alt+Backspace -> showwinDetach 70 | ``` 71 | This will make hot keys *Alt+1* - *Alt+0* fully customizable, any window can be selected and attached to a hot key by pressing a hot key. Further pressing of a hot key will switch to attached window. 72 | To attach another window to a hot key is done in three steps: 73 | 1. Activate desired window. 74 | 2. Activate re-attaching script *showwinDetach* (*Alt+Backspace*). 75 | 3. Assign a new window by pressing a hot key (*Alt+1* - *Alt+0*). 76 | 77 | 78 | -------------------------------------------------------------------------------- /hotkeys-samples/gnome-hotkeys: -------------------------------------------------------------------------------- 1 | [/] 2 | custom-keybindings=['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom1/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom2/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom3/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom4/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom5/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom6/', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom7/'] 3 | 4 | [custom-keybindings/custom0] 5 | binding='f' 6 | command='showwin "Mozilla Firefox$" firefox' 7 | name='Firefox' 8 | 9 | [custom-keybindings/custom1] 10 | binding='p' 11 | command='showwin "Mozilla Firefox (Private Browsing)$" "firefox -private-window"' 12 | name='Firefox Private' 13 | 14 | [custom-keybindings/custom2] 15 | binding='i' 16 | command='showwin "chromium-browser.Chromium-browser" "chromium-browser -incognito"' 17 | name='Chromium Incognito' 18 | 19 | [custom-keybindings/custom3] 20 | binding='c' 21 | command='showwin chromium-browser.Chromium-browser chromium-browser' 22 | name='Chromium' 23 | 24 | [custom-keybindings/custom4] 25 | binding='t' 26 | command='showwin "terminator.Terminator" terminator' 27 | name='Terminal' 28 | 29 | [custom-keybindings/custom5] 30 | binding='s' 31 | command='showwin "skype.Skype" skypeforlinux' 32 | name='Skype' 33 | 34 | [custom-keybindings/custom6] 35 | binding='k' 36 | command='showwin "krusader.krusader" krusader' 37 | name='Krusader' 38 | 39 | [custom-keybindings/custom7] 40 | binding='e' 41 | command='showwin "sun-awt-X11-XFramePeer.jetbrains-idea" idea.sh' 42 | name='IntelliJ Idea' 43 | -------------------------------------------------------------------------------- /hotkeys-samples/gnome-hotkeys-import: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # To export hotkeys use this command: 4 | # dconf dump /org/gnome/settings-daemon/plugins/media-keys/ > gnome-hotkeys 5 | 6 | dconf load /org/gnome/settings-daemon/plugins/media-keys/ < gnome-hotkeys 7 | -------------------------------------------------------------------------------- /hotkeys-samples/kde_hotkeys.khotkeys: -------------------------------------------------------------------------------- 1 | [Data] 2 | DataCount=1 3 | 4 | [Data_1] 5 | Comment=Comment 6 | DataCount=11 7 | Enabled=true 8 | Name=Quick launch 9 | SystemGroup=0 10 | Type=ACTION_DATA_GROUP 11 | 12 | [Data_1Conditions] 13 | Comment= 14 | ConditionsCount=0 15 | 16 | [Data_1_1] 17 | Comment=Comment 18 | Enabled=true 19 | Name=Firefox 20 | Type=SIMPLE_ACTION_DATA 21 | 22 | [Data_1_10] 23 | Comment=Comment 24 | Enabled=true 25 | Name=Idea 26 | Type=SIMPLE_ACTION_DATA 27 | 28 | [Data_1_10Actions] 29 | ActionsCount=1 30 | 31 | [Data_1_10Actions0] 32 | CommandURL=showwin "jetbrains-idea" idea.sh 33 | Type=COMMAND_URL 34 | 35 | [Data_1_10Conditions] 36 | Comment= 37 | ConditionsCount=0 38 | 39 | [Data_1_10Triggers] 40 | Comment=Simple_action 41 | TriggersCount=1 42 | 43 | [Data_1_10Triggers0] 44 | Key=Alt+E 45 | Type=SHORTCUT 46 | Uuid={7b0a4020-93b8-49d8-a133-cb084a007242} 47 | 48 | [Data_1_11] 49 | Comment=Comment 50 | DataCount=11 51 | Enabled=true 52 | Name=Customizable 53 | SystemGroup=0 54 | Type=ACTION_DATA_GROUP 55 | 56 | [Data_1_11Conditions] 57 | Comment= 58 | ConditionsCount=0 59 | 60 | [Data_1_11_1] 61 | Comment=Comment 62 | Enabled=true 63 | Name=Alt+1 64 | Type=SIMPLE_ACTION_DATA 65 | 66 | [Data_1_11_10] 67 | Comment=Comment 68 | Enabled=true 69 | Name=Alt+0 70 | Type=SIMPLE_ACTION_DATA 71 | 72 | [Data_1_11_10Actions] 73 | ActionsCount=1 74 | 75 | [Data_1_11_10Actions0] 76 | CommandURL=showwin "CustomKey0" 77 | Type=COMMAND_URL 78 | 79 | [Data_1_11_10Conditions] 80 | Comment= 81 | ConditionsCount=0 82 | 83 | [Data_1_11_10Triggers] 84 | Comment=Simple_action 85 | TriggersCount=1 86 | 87 | [Data_1_11_10Triggers0] 88 | Key=Alt+0 89 | Type=SHORTCUT 90 | Uuid={2873ea69-1349-4636-87a1-769d49be21d3} 91 | 92 | [Data_1_11_11] 93 | Comment=Comment 94 | Enabled=true 95 | Name=Detach last window 96 | Type=SIMPLE_ACTION_DATA 97 | 98 | [Data_1_11_11Actions] 99 | ActionsCount=1 100 | 101 | [Data_1_11_11Actions0] 102 | CommandURL=showwinDetach 103 | Type=COMMAND_URL 104 | 105 | [Data_1_11_11Conditions] 106 | Comment= 107 | ConditionsCount=0 108 | 109 | [Data_1_11_11Triggers] 110 | Comment=Simple_action 111 | TriggersCount=1 112 | 113 | [Data_1_11_11Triggers0] 114 | Key=Alt+Backspace 115 | Type=SHORTCUT 116 | Uuid={8f667f60-912a-470a-a86e-be662bc6e3a6} 117 | 118 | [Data_1_11_1Actions] 119 | ActionsCount=1 120 | 121 | [Data_1_11_1Actions0] 122 | CommandURL=showwin "CustomKey1" 123 | Type=COMMAND_URL 124 | 125 | [Data_1_11_1Conditions] 126 | Comment= 127 | ConditionsCount=0 128 | 129 | [Data_1_11_1Triggers] 130 | Comment=Simple_action 131 | TriggersCount=1 132 | 133 | [Data_1_11_1Triggers0] 134 | Key=Alt+1 135 | Type=SHORTCUT 136 | Uuid={d361d0a5-0d06-416e-918b-1c6b3ab3577c} 137 | 138 | [Data_1_11_2] 139 | Comment=Comment 140 | Enabled=true 141 | Name=Alt+2 142 | Type=SIMPLE_ACTION_DATA 143 | 144 | [Data_1_11_2Actions] 145 | ActionsCount=1 146 | 147 | [Data_1_11_2Actions0] 148 | CommandURL=showwin "CustomKey2" 149 | Type=COMMAND_URL 150 | 151 | [Data_1_11_2Conditions] 152 | Comment= 153 | ConditionsCount=0 154 | 155 | [Data_1_11_2Triggers] 156 | Comment=Simple_action 157 | TriggersCount=1 158 | 159 | [Data_1_11_2Triggers0] 160 | Key=Alt+2 161 | Type=SHORTCUT 162 | Uuid={fd5b1016-3194-4ecf-b495-9108e6c58e2a} 163 | 164 | [Data_1_11_3] 165 | Comment=Comment 166 | Enabled=true 167 | Name=Alt+3 168 | Type=SIMPLE_ACTION_DATA 169 | 170 | [Data_1_11_3Actions] 171 | ActionsCount=1 172 | 173 | [Data_1_11_3Actions0] 174 | CommandURL=showwin "CustomKey3" 175 | Type=COMMAND_URL 176 | 177 | [Data_1_11_3Conditions] 178 | Comment= 179 | ConditionsCount=0 180 | 181 | [Data_1_11_3Triggers] 182 | Comment=Simple_action 183 | TriggersCount=1 184 | 185 | [Data_1_11_3Triggers0] 186 | Key=Alt+3 187 | Type=SHORTCUT 188 | Uuid={7cc562a8-272d-4be3-ac47-37eaf1186bbb} 189 | 190 | [Data_1_11_4] 191 | Comment=Comment 192 | Enabled=true 193 | Name=Alt+4 194 | Type=SIMPLE_ACTION_DATA 195 | 196 | [Data_1_11_4Actions] 197 | ActionsCount=1 198 | 199 | [Data_1_11_4Actions0] 200 | CommandURL=showwin "CustomKey4" 201 | Type=COMMAND_URL 202 | 203 | [Data_1_11_4Conditions] 204 | Comment= 205 | ConditionsCount=0 206 | 207 | [Data_1_11_4Triggers] 208 | Comment=Simple_action 209 | TriggersCount=1 210 | 211 | [Data_1_11_4Triggers0] 212 | Key=Alt+4 213 | Type=SHORTCUT 214 | Uuid={c38aa9eb-7249-40c8-bff1-7aabbba6d5f2} 215 | 216 | [Data_1_11_5] 217 | Comment=Comment 218 | Enabled=true 219 | Name=Alt+5 220 | Type=SIMPLE_ACTION_DATA 221 | 222 | [Data_1_11_5Actions] 223 | ActionsCount=1 224 | 225 | [Data_1_11_5Actions0] 226 | CommandURL=showwin "CustomKey5" 227 | Type=COMMAND_URL 228 | 229 | [Data_1_11_5Conditions] 230 | Comment= 231 | ConditionsCount=0 232 | 233 | [Data_1_11_5Triggers] 234 | Comment=Simple_action 235 | TriggersCount=1 236 | 237 | [Data_1_11_5Triggers0] 238 | Key=Alt+5 239 | Type=SHORTCUT 240 | Uuid={d68cef40-0a0b-4708-9a13-2a64ea860b9c} 241 | 242 | [Data_1_11_6] 243 | Comment=Comment 244 | Enabled=true 245 | Name=Alt+6 246 | Type=SIMPLE_ACTION_DATA 247 | 248 | [Data_1_11_6Actions] 249 | ActionsCount=1 250 | 251 | [Data_1_11_6Actions0] 252 | CommandURL=showwin "CustomKey6" 253 | Type=COMMAND_URL 254 | 255 | [Data_1_11_6Conditions] 256 | Comment= 257 | ConditionsCount=0 258 | 259 | [Data_1_11_6Triggers] 260 | Comment=Simple_action 261 | TriggersCount=1 262 | 263 | [Data_1_11_6Triggers0] 264 | Key=Alt+6 265 | Type=SHORTCUT 266 | Uuid={2cf18917-ace8-45ba-81da-9e2f448241e1} 267 | 268 | [Data_1_11_7] 269 | Comment=Comment 270 | Enabled=true 271 | Name=Alt+7 272 | Type=SIMPLE_ACTION_DATA 273 | 274 | [Data_1_11_7Actions] 275 | ActionsCount=1 276 | 277 | [Data_1_11_7Actions0] 278 | CommandURL=showwin "CustomKey7" 279 | Type=COMMAND_URL 280 | 281 | [Data_1_11_7Conditions] 282 | Comment= 283 | ConditionsCount=0 284 | 285 | [Data_1_11_7Triggers] 286 | Comment=Simple_action 287 | TriggersCount=1 288 | 289 | [Data_1_11_7Triggers0] 290 | Key=Alt+7 291 | Type=SHORTCUT 292 | Uuid={52fefcaa-1242-48ba-b5ea-91084df534f1} 293 | 294 | [Data_1_11_8] 295 | Comment=Comment 296 | Enabled=true 297 | Name=Alt+8 298 | Type=SIMPLE_ACTION_DATA 299 | 300 | [Data_1_11_8Actions] 301 | ActionsCount=1 302 | 303 | [Data_1_11_8Actions0] 304 | CommandURL=showwin "CustomKey8" 305 | Type=COMMAND_URL 306 | 307 | [Data_1_11_8Conditions] 308 | Comment= 309 | ConditionsCount=0 310 | 311 | [Data_1_11_8Triggers] 312 | Comment=Simple_action 313 | TriggersCount=1 314 | 315 | [Data_1_11_8Triggers0] 316 | Key=Alt+8 317 | Type=SHORTCUT 318 | Uuid={00a8724f-d9ca-4ec4-8509-cc77980cb29f} 319 | 320 | [Data_1_11_9] 321 | Comment=Comment 322 | Enabled=true 323 | Name=Alt+9 324 | Type=SIMPLE_ACTION_DATA 325 | 326 | [Data_1_11_9Actions] 327 | ActionsCount=1 328 | 329 | [Data_1_11_9Actions0] 330 | CommandURL=showwin "CustomKey9" 331 | Type=COMMAND_URL 332 | 333 | [Data_1_11_9Conditions] 334 | Comment= 335 | ConditionsCount=0 336 | 337 | [Data_1_11_9Triggers] 338 | Comment=Simple_action 339 | TriggersCount=1 340 | 341 | [Data_1_11_9Triggers0] 342 | Key=Alt+9 343 | Type=SHORTCUT 344 | Uuid={734145b5-2827-488c-b308-25b971e528ff} 345 | 346 | [Data_1_1Actions] 347 | ActionsCount=1 348 | 349 | [Data_1_1Actions0] 350 | CommandURL=showwin "Mozilla Firefox$" firefox 351 | Type=COMMAND_URL 352 | 353 | [Data_1_1Conditions] 354 | Comment= 355 | ConditionsCount=0 356 | 357 | [Data_1_1Triggers] 358 | Comment=Simple_action 359 | TriggersCount=1 360 | 361 | [Data_1_1Triggers0] 362 | Key=Alt+F 363 | Type=SHORTCUT 364 | Uuid={cbc9487a-d4f2-44f0-8baf-2c9d8cbf32aa} 365 | 366 | [Data_1_2] 367 | Comment=Comment 368 | Enabled=true 369 | Name=Firefox private 370 | Type=SIMPLE_ACTION_DATA 371 | 372 | [Data_1_2Actions] 373 | ActionsCount=1 374 | 375 | [Data_1_2Actions0] 376 | CommandURL=showwin "Mozilla Firefox (Private Browsing)$" "firefox -private-window" 377 | Type=COMMAND_URL 378 | 379 | [Data_1_2Conditions] 380 | Comment= 381 | ConditionsCount=0 382 | 383 | [Data_1_2Triggers] 384 | Comment=Simple_action 385 | TriggersCount=1 386 | 387 | [Data_1_2Triggers0] 388 | Key=Alt+P 389 | Type=SHORTCUT 390 | Uuid={a489fb08-b653-48ab-ba16-527d84b9bd5b} 391 | 392 | [Data_1_3] 393 | Comment=Comment 394 | Enabled=true 395 | Name=Chromium 396 | Type=SIMPLE_ACTION_DATA 397 | 398 | [Data_1_3Actions] 399 | ActionsCount=1 400 | 401 | [Data_1_3Actions0] 402 | CommandURL=showwin "chromium-browser.Chromium-browser N*" chromium-browser 403 | Type=COMMAND_URL 404 | 405 | [Data_1_3Conditions] 406 | Comment= 407 | ConditionsCount=0 408 | 409 | [Data_1_3Triggers] 410 | Comment=Simple_action 411 | TriggersCount=1 412 | 413 | [Data_1_3Triggers0] 414 | Key=Alt+C 415 | Type=SHORTCUT 416 | Uuid={7e26c6a8-8cc2-4068-b027-285b418f0369} 417 | 418 | [Data_1_4] 419 | Comment=Comment 420 | Enabled=true 421 | Name=Chromium incognito 422 | Type=SIMPLE_ACTION_DATA 423 | 424 | [Data_1_4Actions] 425 | ActionsCount=1 426 | 427 | [Data_1_4Actions0] 428 | CommandURL=showwin "chromium-browser.Chromium-browser I*" "chromium-browser --incognito" 429 | Type=COMMAND_URL 430 | 431 | [Data_1_4Conditions] 432 | Comment= 433 | ConditionsCount=0 434 | 435 | [Data_1_4Triggers] 436 | Comment=Simple_action 437 | TriggersCount=1 438 | 439 | [Data_1_4Triggers0] 440 | Key=Alt+I 441 | Type=SHORTCUT 442 | Uuid={edcc1f51-67d7-48e9-b208-123f8e75edd8} 443 | 444 | [Data_1_5] 445 | Comment=Comment 446 | Enabled=true 447 | Name=Tor browser 448 | Type=SIMPLE_ACTION_DATA 449 | 450 | [Data_1_5Actions] 451 | ActionsCount=1 452 | 453 | [Data_1_5Actions0] 454 | CommandURL=showwin "Navigator.Tor" start-tor-browser 455 | Type=COMMAND_URL 456 | 457 | [Data_1_5Conditions] 458 | Comment= 459 | ConditionsCount=0 460 | 461 | [Data_1_5Triggers] 462 | Comment=Simple_action 463 | TriggersCount=1 464 | 465 | [Data_1_5Triggers0] 466 | Key=Alt+Y 467 | Type=SHORTCUT 468 | Uuid={a52e6c8d-d078-4dcd-8bb6-943225d89fe0} 469 | 470 | [Data_1_6] 471 | Comment=Comment 472 | Enabled=true 473 | Name=Calculator 474 | Type=SIMPLE_ACTION_DATA 475 | 476 | [Data_1_6Actions] 477 | ActionsCount=1 478 | 479 | [Data_1_6Actions0] 480 | CommandURL=showwin "gnome-calculator.Gnome-calculator" gnome-calculator 481 | Type=COMMAND_URL 482 | 483 | [Data_1_6Conditions] 484 | Comment= 485 | ConditionsCount=0 486 | 487 | [Data_1_6Triggers] 488 | Comment=Simple_action 489 | TriggersCount=1 490 | 491 | [Data_1_6Triggers0] 492 | Key=Alt+M 493 | Type=SHORTCUT 494 | Uuid={048d6ec4-f985-45f6-b29b-3fe0abeefbf3} 495 | 496 | [Data_1_7] 497 | Comment=Comment 498 | Enabled=true 499 | Name=Terminal 500 | Type=SIMPLE_ACTION_DATA 501 | 502 | [Data_1_7Actions] 503 | ActionsCount=1 504 | 505 | [Data_1_7Actions0] 506 | CommandURL=showwin "terminator.Terminator" terminator 507 | Type=COMMAND_URL 508 | 509 | [Data_1_7Conditions] 510 | Comment= 511 | ConditionsCount=0 512 | 513 | [Data_1_7Triggers] 514 | Comment=Simple_action 515 | TriggersCount=1 516 | 517 | [Data_1_7Triggers0] 518 | Key=Alt+T 519 | Type=SHORTCUT 520 | Uuid={f6c4a769-e208-4546-a3b1-137472e2b768} 521 | 522 | [Data_1_8] 523 | Comment=Comment 524 | Enabled=true 525 | Name=Krusader 526 | Type=SIMPLE_ACTION_DATA 527 | 528 | [Data_1_8Actions] 529 | ActionsCount=1 530 | 531 | [Data_1_8Actions0] 532 | CommandURL=showwin "krusader.krusader" krusader 533 | Type=COMMAND_URL 534 | 535 | [Data_1_8Conditions] 536 | Comment= 537 | ConditionsCount=0 538 | 539 | [Data_1_8Triggers] 540 | Comment=Simple_action 541 | TriggersCount=1 542 | 543 | [Data_1_8Triggers0] 544 | Key=Alt+K 545 | Type=SHORTCUT 546 | Uuid={73552960-0fd8-4431-9b5e-fcc118a3b4d2} 547 | 548 | [Data_1_9] 549 | Comment=Comment 550 | Enabled=true 551 | Name=Skype 552 | Type=SIMPLE_ACTION_DATA 553 | 554 | [Data_1_9Actions] 555 | ActionsCount=1 556 | 557 | [Data_1_9Actions0] 558 | CommandURL=showwin "skype.Skype" skypeforlinux 559 | Type=COMMAND_URL 560 | 561 | [Data_1_9Conditions] 562 | Comment= 563 | ConditionsCount=0 564 | 565 | [Data_1_9Triggers] 566 | Comment=Simple_action 567 | TriggersCount=1 568 | 569 | [Data_1_9Triggers0] 570 | Key=Alt+S 571 | Type=SHORTCUT 572 | Uuid={ca00f051-faef-4f89-aa46-2c0b9dadafd7} 573 | 574 | [Main] 575 | AllowMerge=false 576 | ImportId=Quick launch 577 | Version=2 578 | -------------------------------------------------------------------------------- /showwin: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # sudo apt-get install wmctrl xdotool 4 | 5 | # STORAGE_DIR="/tmp/showwin" 6 | STORAGE_DIR="/dev/shm/$USER/showwin" 7 | 8 | SWITCH_DIR="$STORAGE_DIR/$1" 9 | UNPIN_DIR="$STORAGE_DIR/reset_pinned" 10 | 11 | mkdir -p "$SWITCH_DIR" 12 | 13 | if [[ -d $UNPIN_DIR ]]; then 14 | PINNED_ID= 15 | rm -rf $UNPIN_DIR 16 | else 17 | PINNED_ID=`ls "$SWITCH_DIR"` 18 | fi 19 | 20 | 21 | MATCHED_WIN=`wmctrl -l -x | grep -i "$1\|^$PINNED_ID "` 22 | if [[ -z $MATCHED_WIN && -z $2 ]]; then 23 | echo "Assigning new window" 24 | MATCHED_WIN=`wmctrl -l -x` 25 | fi 26 | 27 | CURRENT_ID=`xdotool getwindowfocus` 28 | CURRENT_ID=`printf "0x%08x" $CURRENT_ID` 29 | MATCHED_CURRENT_ID=`echo "$MATCHED_WIN" | grep "^$CURRENT_ID " | head -1 | cut -d" " -f1` 30 | MATCHED_PINNED_ID=`echo "$MATCHED_WIN" | grep "^$PINNED_ID " | head -1 | cut -d" " -f1` 31 | 32 | if [[ -n $MATCHED_PINNED_ID ]]; then 33 | MATCHED_ID=$MATCHED_PINNED_ID 34 | elif [[ -n $MATCHED_CURRENT_ID ]]; then 35 | MATCHED_ID=$MATCHED_CURRENT_ID 36 | else 37 | MATCHED_ID=`echo "$MATCHED_WIN" | head -1 | cut -d" " -f1` 38 | fi 39 | 40 | 41 | if [[ -n "$MATCHED_CURRENT_ID" ]] && [[ "$MATCHED_PINNED_ID" -eq "$MATCHED_CURRENT_ID" ]]; then 42 | echo "Minimize" 43 | xdotool getactivewindow windowminimize 44 | elif [[ -n $MATCHED_ID ]]; then 45 | echo "Switching to window $MATCHED_ID" 46 | wmctrl -a $MATCHED_ID -i 47 | elif [[ -n $2 ]]; then 48 | echo "Opening new window $2" 49 | $2& 50 | 51 | # wait up to 5 seconds while window is opening 52 | end=$((SECONDS+5)) 53 | while [[ -z `wmctrl -l -x | grep -i "$1"` && $SECONDS -lt $end ]]; do 54 | sleep 0.2 55 | done 56 | MATCHED_ID=`wmctrl -l -x | grep -i "$1" | head -1 | cut -d" " -f1` 57 | wmctrl -a $MATCHED_ID -i 58 | fi 59 | 60 | 61 | if [[ -n $MATCHED_ID ]]; then 62 | rm -r "$SWITCH_DIR"/* > /dev/null 63 | mkdir -p "$SWITCH_DIR/$MATCHED_ID" 64 | fi 65 | -------------------------------------------------------------------------------- /showwinDetach: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir /dev/shm/$USER/showwin/reset_pinned 4 | --------------------------------------------------------------------------------