User Tools

Site Tools


linux:linux_desktop

Linux Desktop

Some usage tips and fixes for Linux Desktop Environment(s)

JWM stuff

dumped…

jwm_key_mask.txt
jwm mask modifier
- mod key map can be checked using xmodmap -pm

My last used config - requires xdgmenumaker (getslackbuild)

dot-jwmrc
<?xml version="1.0"?>
<JWM>
	<RootMenu onroot="3">
		<Program icon="terminal.png" label="Terminal">st -g 110x35</Program>
		<Program icon="file-manager.png" label="File Manager">rox</Program>
		<Program icon="text-editor.png" label="Editor">geany_space</Program>
		<Program icon="browser.png" label="Browser">firefox</Program>
		<Separator/>
		<Program icon="drive-harddisk.png" label="Mount Tool">my1pmount-gtk</Program>
		<Separator/>
		<Include>exec: xdgmenumaker -n -i -f jwm</Include>
		<Separator/>
		<Program icon="reload3.png" label="Reload Menu">jwm -reload</Program>
		<Restart icon="reload.png" label="Restart JWM"/>
		<Exit icon="exit.png" label="Exit JWM"/>
		<Separator/>
		<Program icon="redo.png" label="Reboot">loginctl reboot</Program>
		<Program icon="system-shutdown.png" label="Shutdown">loginctl poweroff</Program>
	</RootMenu>
	<Group>
		<Name>st</Name>
		<Option>cascaded</Option>
	</Group>
	<Tray x="0" y="0" autohide="off">
		<TrayButton label="MY1">root:3</TrayButton>
		<Spacer width="2"/>
		<TrayButton label="Desktop">showdesktop</TrayButton>
		<Spacer width="2"/>
		<Pager labeled="true"/>
		<TaskList maxwidth="256"/>
		<Dock/>
		<Clock format="%Y%m%d %H:%M"></Clock>
	</Tray>
	<WindowStyle>
		<Font>Sans-10:bold</Font>
		<Width>4</Width>
		<Height>21</Height>
		<Corner>3</Corner>
		<Foreground>#FFFFFF</Foreground>
		<Background>#555555</Background>
		<Outline>#000000</Outline>
		<Opacity>0.5</Opacity>
		<Active>
			<Foreground>#FFFFFF</Foreground>
			<Background>#0077CC</Background>
			<Outline>#000000</Outline>
			<Opacity>1.0</Opacity>
		</Active>
	</WindowStyle>
	<TrayStyle group="true" list="desktop">
		<Font>Sans-10</Font>
		<Background>#333333</Background>
		<Foreground>#FFFFFF</Foreground>
		<Outline>#000000</Outline>
		<Opacity>0.75</Opacity>
	</TrayStyle>
	<TaskListStyle>
		<Font>Sans-10</Font>
		<Active>
			<Foreground>#FFFFFF</Foreground>
			<Background>#555555</Background>
		</Active>
		<Foreground>#FFFFFF</Foreground>
		<Background>#333333</Background>
	</TaskListStyle>
	<PagerStyle>
		<Outline>#000000</Outline>
		<Foreground>#555555</Foreground>
		<Background>#333333</Background>
		<Text>#FFFFFF</Text>
		<Active>
			<Foreground>#0077CC</Foreground>
			<Background>#004488</Background>
		</Active>
	</PagerStyle>
	<MenuStyle>
		<Font>Sans-10</Font>
		<Foreground>#FFFFFF</Foreground>
		<Background>#333333</Background>
		<Outline>#000000</Outline>
		<Active>
			<Foreground>#FFFFFF</Foreground>
			<Background>#0077CC</Background>
		</Active>
		<Opacity>0.85</Opacity>
	</MenuStyle>
	<PopupStyle>
		<Font>Sans-10</Font>
		<Foreground>#000000</Foreground>
		<Background>#999999</Background>
	</PopupStyle>
	<IconPath>/usr/share/icons/hicolor/16x16/apps</IconPath>
	<IconPath>/usr/share/icons/Tango/16x16/apps</IconPath>
	<IconPath>/usr/share/icons/Tango/16x16/actions</IconPath>
	<IconPath>/usr/share/icons/Tango/16x16/devices</IconPath>
	<IconPath>/usr/share/icons/Tango/16x16/categories</IconPath>
	<IconPath>/usr/share/icons/Tango/16x16/mimetypes</IconPath>
	<IconPath>/usr/share/icons/Adwaita/16x16/apps</IconPath>
	<IconPath>/usr/share/icons/Adwaita/16x16/actions</IconPath>
	<IconPath>/usr/share/icons/Adwaita/16x16/categories</IconPath>
	<IconPath>/usr/share/pixmaps</IconPath>
	<IconPath>/usr/share/jwm</IconPath>
	<Desktops width="2" height="1">
		<!--<Background type="solid">#111111</Background>-->
		<Background type="scale">/usr/share/jwm/slackwall.png</Background>
	</Desktops>
	<!-- Double click speed (in milliseconds) -->
	<DoubleClickSpeed>400</DoubleClickSpeed>
	<!-- Double click delta (in pixels) -->
	<DoubleClickDelta>2</DoubleClickDelta>
	<!-- The focus model (sloppy or click) -->
	<FocusModel>click</FocusModel>
	<!-- The snap mode (none, screen, or border) -->
	<SnapMode distance="10">border</SnapMode>
	<!-- The move mode (outline or opaque) -->
	<MoveMode>opaque</MoveMode>
	<!-- The resize mode (outline or opaque) -->
	<ResizeMode>opaque</ResizeMode>
	<!-- Key bindings -->
	<Key key="Up">up</Key>
	<Key key="Down">down</Key>
	<Key key="Right">right</Key>
	<Key key="Left">left</Key>
	<Key key="h">left</Key>
	<Key key="j">down</Key>
	<Key key="k">up</Key>
	<Key key="l">right</Key>
	<Key key="Return">select</Key>
	<Key key="Escape">escape</Key>
	<Key mask="A" key="p">exec:dmenu_run -b</Key>
	<Key mask="A" key="Tab">nextstacked</Key>
	<Key mask="A" key="F4">close</Key>
	<Key mask="A" key="#">desktop#</Key>
	<Key mask="A" key="F1">root:3</Key>
	<Key mask="A" key="F2">window</Key>
	<Key mask="A" key="F5">move</Key>
	<Key mask="A" key="F6">resize</Key>
	<Key mask="A" key="F10">maximize</Key>
	<Key mask="A" key="F11">fullscreen</Key>
	<Key mask="A" key="Right">rdesktop</Key>
	<Key mask="A" key="Left">ldesktop</Key>
	<Key mask="A" key="Up">udesktop</Key>
	<Key mask="A" key="Down">ddesktop</Key>
	<Key mask="CA" key="Up">maxtop</Key>
	<Key mask="CA" key="Down">maxbottom</Key>
	<Key mask="CA" key="Right">maxright</Key>
	<Key mask="CA" key="Left">maxleft</Key>
	<Key mask="C4" key="v">maxv</Key>
	<Key mask="C4" key="h">maxh</Key>
	<Key mask="CA" key="l">exec:xlock -mode matrix</Key>
	<Key mask="CA" key="m">exec:my1pmount-gtk</Key>
	<Key mask="CA" key="plus">exec:volume +</Key>
	<Key mask="CA" key="minus">exec:volume -</Key>
	<Key mask="AS" key="Return">exec:st -g 110x35</Key>
	<StartupCommand>nm-applet</StartupCommand>
	<SnapMode>none</SnapMode>
</JWM>

DWM stuff

dumped…

dwm_hotkeys.txt
Mod = Alt
 
[Shift]+[Mod]+[Enter]   - launch terminal.
[Mod]+[b]               - show/hide bar.
[Mod]+[p]               - dmenu
[Mod]+[Enter]           - swap master with top stack
[Mod] + [j / k]         - focus on next/previous window in current tag.
[Mod] + [h / l]         - increases / decreases master size.
 
[Mod]+[2]               - moves your focus to tag 2.
[Shift]+[Mod]+[2]       - move active window to the 2 tag.
 
[Mod] + [i / d]         - increases / decreases number of windows on master
[Mod] + [, / .]         - move focus between screens (multi monitor setup)
[Shift]+[Mod]+[, / .]   - move active window to different screen.
 
[Mod]+[0]               - view all windows on screen.
[Shift]+[Mod]+[0]       - make focused window appear on all tags.
[Shift]+[Mod]+[c]       - kill active window.
[Shift]+[Mod]+[q]       - quit dwm cleanly.
 
[Mod]+[t]               - tiling mode
[Mod]+[f]               - floating mode
[Mod]+[m]               - monocle mod
 
[Mod]+[R M B]           - to resize the floating window.
[Mod]+[L M B]           - to move the floating window around.
[Mod]+[Space]           - toggles to the previous layout mode.
[Mod]+[Shift]+[Space]   - to make an individual window float.
[Mod]+[M M B]           - to make an individual window un-float.
st_hotkeys.txt
[Shift]+[Mod]+[PageUp]  - increase font size
[Shift]+[Mod]+[PageDn]  - decrease font size
[Shift]+[Mod]+[Home]    - reset font size

Generic Stuff

Applicable to most (if not all) DE/WM.

Geany on multiple workspaces

geany_space
#!/bin/bash
# from: https://unix.stackexchange.com/questions/246827/geany-open-a-new-instance-per-workspace-when-opening-a-file-in-that-workspace
 
socket=$(xprop -root _NET_CURRENT_DESKTOP)
socket=${socket##* }
 
if [ "$socket" ] ; then
	if [ "$DISPLAY" ] ; then
		socket="${DISPLAY%.*}-$socket"
		socket=${socket#*:}
	else
		socket="NODISPLAY-$socket"
	fi
	exec geany --socket-file "/tmp/geany_socket_$socket" "$@"
else
	exec geany "$@"
fi
geany_space.desktop
[Desktop Entry]
Type=Application
Version=1.0
Name=Geany (Workspace)
Comment=Geany wrapper to detect workspace
Exec=geany_space %F
Icon=geany
Terminal=false
Categories=Development;IDE;
MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;
StartupNotify=true
Keywords=Text;Editor;

Useful Desktop Files

The *.desktop files provide menu entry for applications.

arduino-ide.desktop
[Desktop Entry]
Type=Application
Version=1.0
Name=Arduino IDE (App-Image)
Comment=Arduino IDE
Exec=/home/share/appx/app-image/arduino-ide %F
#Icon=
Terminal=false
Categories=Development;IDE;
#MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;
StartupNotify=true
#Keywords=Text;Editor;
android-studio.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=Android Studio
Comment=
Exec=env JAVA_HOME=/home/share/appx/android-studio/jbr /home/share/appx/android-studio/bin/studio.sh
Icon=/home/share/appx/android-studio/bin/studio.png
Path=/home/share/appx/android-studio/bin
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-studio
StartupNotify=true
xfig.desktop
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
NoDisplay=true
Exec=/usr/bin/xfig -nowrite_bak %f
Name=xfig -nowrite_bak
Comment=Custom definition for xfig -nowrite_bak

Using xdg-mime

Dumped

- get mime type of <filename>
$ xdg-mime query filetype <filename>

- get currently set default app for a <mime/type>
$ xdg-mime query default <mime/type>

- set a new default app for a <mime/type>
$ xdg-mime default app.desktop <mime/type>

User Applications

Some specific use-cases (for my personal reference)

  • Video subtitle (*.srt) editor - gaupol (apt,slackbuilds)

XFCE: Slackware64-15.0

Icons for extra/unused partitions on my hard disk are shown on XFCE desktop. I DO NOT want this!

  • Create a udev rule in udev/rules.d path
    10-hdpart.rules
    KERNEL=="sda3", ENV{UDISKS_IGNORE}="1"
    KERNEL=="sda4", ENV{UDISKS_IGNORE}="1"
    • add more lines as required
  • Reload udev rules
    udevadm control --reload-rules && udevadm trigger

XFCE: Clock Panel

Custom Digital Clock settings on XFCE

<span size='x-small'>%Y%m%d%n</span><b>%H:%M:%S</b>
<span size='x-small'><i>%Y-%m-%d</i>%n</span><span size='small'><b>%T</b></span>
<span size='small'><b>%Y%m%d</b></span>  %H:%M:%S

XFCE: Terminal Shortcut for Thunar

Note20230501 No longer needed? Simply go Edit>Configure custom actions… and set it there.

There is already a User Custom Action (UCA) defined to 'Open Terminal Here' - so we just need to add a shortcut.

  • Find that UCA id from ~/.config/Thunar/uca.xml
  • Locate that id in ~/.config/Thunar/accels.scm
    • uncomment and add shortcut key, e.g. F4

XFCE: Quake-Style Terminal

XFCE4 terminal can actually run in a drop-down mode (Quake-style):

xfce4-terminal --drop-down --hide-menubar

Use keyboard settings (Settings→Keyboard): Create new entry in 'Application Shortcuts' tab with the previous command, with <F12> as trigger key.

XFCE: Remove Suspend/Hibernate Button

xfconf-query -c xfce4-session -np '/shutdown/ShowSuspend' -t 'bool' -s 'false'
xfconf-query -c xfce4-session -np '/shutdown/ShowHibernate' -t 'bool' -s 'false'
xfconf-query -c xfce4-session -np '/shutdown/ShowHybridSleep' -t 'bool' -s 'false'

Sometimes this is also annoying?

xfconf-query -c xfce4-session -np '/shutdown/ShowSwitchUser' -t 'bool' -s 'false'

XFCE: Multi-User

Copying XFCE settings for other users:

clone-xfceconf
#!/bin/bash
 
DSTUSER=$1
[ -z "$DSTUSER" ] && echo "** Missing target username!" && exit 1
 
SRCUSER=$(pwd)
SRCTEST=$(dirname $SRCUSER)
 
while [ 1 ] ; do
[ "$SRCTEST" == "/" ] &&
	echo "** Cannot find /home in current path!" && exit 1
[ "$SRCTEST" == "/home" ] && break;
SRCUSER=$(basename $SRCTEST)
SRCTEST=$(dirname $SRCTEST)
done
echo "-- Using user '$SRCUSER' as source!"
 
DSTHOME="/home/$DSTUSER"
SRCHOME="/home/$SRCUSER"
 
[ "$DSTUSER" == "$SRCUSER" ] &&
	echo "** Target ($DSTUSER) same as source ($SRCUSER)?" && exit 1
 
[ ! -d "$DSTHOME" ] &&
	echo "** Cannot find target user path '$DSTHOME'!" && exit 1
 
[ ! -d "$SRCHOME" ] &&
	echo "** Cannot find source user path '$SRCHOME'!" && exit 1
 
DST_GRP=$(groups $DSTUSER | sed 's/.* : \([^[:space:]]*\).*$/\1/')
echo "-- Target:{$DSTUSER:$DST_GRP}"
[ $UID -ne 0 ] && echo -e "\n** Must run as root!\n" && exit 1
 
CHKCONF="Thunar geany xfce4"
for conf in $CHKCONF ; do
	SRCCONF="$SRCHOME/.config/$conf"
	[ ! -d "$SRCCONF" ] && continue
	DSTCONF="$DSTHOME/.config/$conf"
	if [ -d "$DSTCONF" ] ; then
		echo -n "-- Deleting $DSTCONF... "
		rm -rf $DSTCONF
		[ $? -ne 0 ] && echo -n "**error0** "
		echo "done."
	fi
	echo -n "-- Copying $SRCCONF as $DSTCONF... "
	cp -a $SRCCONF $(dirname $DSTCONF)
	[ $? -ne 0 ] && echo -n "**error1** "
	chown -R $DSTUSER:$DST_GRP $DSTCONF
	[ $? -ne 0 ] && echo -n "**error2** "
	echo "done."
done

Cinnamon: Terminal Shortcut for Nemo

Shortcut for nemo file manager

  • $HOME/.gnome2/accels/nemo
    (gtk_accel_path "<Actions>/DirViewActions/OpenInTerminal" "F4")

Cinnamon: Shortcuts

Note: Super key is the Windows key

shortcuts.txt
Ctrl+A­lt+Down: Show the window selection screen
Ctrl+A­lt+Up: Show the workspace selection screen
Ctrl+A­lt+End: Shut down dialog
Super+D: Show the desktop
Alt+F2: Run dialog
Alt+F8: Resize window
Alt+F7: Move window
Super+Left: Push tile left
Super+­Right: Push tile right
Super+Up: Push tile up
Super+Down: Push tile down
Ctrl+S­upe­r+Left: Push snap left +
Ctrl+S­upe­r+Right: Push snap right
Ctrl+S­upe­r+Down: Push snap down
Shift+­Ctr­l+A­lt+Left: Move window to left workspace
Shift+­Ctr­l+A­lt+­Right: Move window to right workspace
Super+­Shi­ft+Left: Move window to left monitor
Super+­Shi­ft+­Right: Move window to right monitor
Super+­Shi­ft+Up: Move window to up monitor
Super+­Shi­ft+Down: Move window to down monitor
Alt+F5: Un-max­imize window
Alt+F4: Minimize window
Alt+Space: Activate window menu
Alt+F10: Toggle maximi­zation state
shortcuts_check.txt
Super+P: Re-detect display devices

Cinnamon: Disable Recent Files

Option is in Menu > Preferences > Privacy

linux/linux_desktop.txt · Last modified: 2023/11/24 21:15 by azman