Showing posts with label bash. Show all posts
Showing posts with label bash. Show all posts

Monday, April 13, 2020

Cycling through all terminal windows without a popup on Ubuntu

Untitled

TL;DR    Download: [nexttermwin.sh] [prevtermwin.sh] script ,set custom global hotkey (e.g. F9,F10 )

Now, pressing F10 and F9 should cycle forward and backwards all terminals windows without popup.

Imagine you have many terminal windows open in fullscreen mode. wmctrl tool can navigate to any open window by typing title substring(incase-sensitive) like to focus Chrome window we can simply try:

But even then title substring cant help us and if we have multiple terminal windows open of same directory, we cannot navigate to specific window in it.

ALT+~ can help us here but requires specific application to be selected. Same goes for other applications with multiple windows open.

ALT+ESC does the job for this and cycles through next windows+instantly navigates to target window without a popup, but it draws a distracting rectangle arround the windows and requires holding these keys pressed until target window reached.

ALT+TAB lets you immediately switch to previous window and switch back which is useful feature. But yet it shows you a popup and requires you to browse through all window popup and select target window.

So, for a more faster and focused window switching we can use xdotool. It can focus any and every window of any desktop by window id provided by window manager of desktop environment. The key here in this script is xdotool gets current window id. wmctrl gets all window ids calculates next window id and activates window:

Cycling backwards:

prevtermwin.sh

Cycling through all Windows:

[nexwin.sh] [prevwin.sh]

For navigating through all windows winIds need to be:

Mapping custom global hotkeys to specific script from linux terminal:

Now, pressing F10 and F9 should call ~/nexttermwin.sh and ~/prevtermwin.sh and cycle window forward and backwards.

Tuesday, November 11, 2014

svn : remove mistakenly added project files and directories within a directory

  1. #Remove unnecessary files and directories by
  2. svn rm file_or_directories
  3. #e.g.
  4. svn rm .settings //directory
  5. svn rm .project //file
  6. svn rm .git //directory
  7. svn rm .idea //directory
  8. #commit all changes
  9. svn commit -m "Your remove message."

Tuesday, October 21, 2014

Git : commit all changes in current directory tree and push to default repository from terminal

  1. #see current changes
  2. git satus
  3. #add changed things to local repo
  4. git add -A
  5. #commit all changes
  6. git commit -a
  7. #see remote repo
  8. git remote
  9. #send to remote repo
  10. git push

Thursday, September 18, 2014

Create new repostory at github and add new directory with files from terminal

Just use this script : committogithub.sh

  1. curl -u $1 https://api.github.com/user/repos -d "{\"name\":\"$2\"}"
  2. git init
  3. git add .
  4. git commit -a -m "added all"
  5. git remote rm origin
  6. git remote add origin "ssh://git@github.com/$1/$2.git"
  7. git remote -v
  8. git push -u origin master

Or Download it (commitnewfilestogithub.sh)


Usage : 


  1. sh committogithub.sh username reponame

Note : Make sure you have setup your ssh correctly for the system you are using at https://github.com/settings/ssh

Friday, July 11, 2014

'clear' command on windows command prompt(cmd)

Create a batch file at C:\Windows\System32\clear.bat.
Place cls command inside it. You can do this by running the following command on an elevated Command Prompt:
  1. echo cls > %WINDIR%\system32\clear.bat
This should create a clear.bat on system32 directory.